import axios from 'axios'

export function logoutApi() {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/user/loginout", null,
        {
            headers: {
                'token': jwt
            }
        })
}


export function editAddressApi(data) {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/user/editAddress", {
        id:data.id ,
        isDefault:data.isDefault ,
        name:data.name ,
        tel:data.tel ,
        area:data.area ,
        detail:data.detail 
    },
        {
            headers: {
                'Content-Type': 'application/json',
                'token': jwt
            }
        })

}


export function delAddressApi(id) {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/user/delAddress", null,
        {
            params: {
                id: id
            },
            headers: {
                'token': jwt
            }
        })
}

export function addAddressApi(data) {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/user/addAddress", {
        isDefault:data.isDefault ,
        name:data.name ,
        tel:data.tel ,
        area:data.area ,
        detail:data.detail 
    },
        {
            headers: {
                'Content-Type': 'application/json',
                'token': jwt
            }
        })

}
